<?php

function assos_get_list_idtheme_lien() {
	$sql = 'SELECT DISTINCT ID_theme FROM `assos_l-t`;';
	return query($sql);
}


function assos_get_list_idlien($id,$page=0) {
	$sql = 'SELECT ID_lien FROM `assos_l-t` WHERE ID_theme='.$id;
	if ($page==0){
			$sql.=';';
		}
		else{
			$init=10*($page-1);
			$sql.=" LIMIT $init,10;";
		}
	return query($sql);
}

function insert_lien_theme($id_theme, $id_lien){
	$sql = "INSERT INTO `assos_l-t` VALUES ('$id_theme', '$id_lien');";
    return query($sql);
}

function delete_lien_and_theme($id_theme, $id_lien){
	$sql = "DELETE FROM `assos_l-t` WHERE ID_lien = '$id_lien' AND ID_theme = '$id_theme' ;";
    return query($sql);
}

function delete_lien_theme($id){
	$sql = 'DELETE FROM `assos_l-t` WHERE ID_lien ='.$id.';';
	return query($sql);
}

function delete_theme_l($id){
	$sql = 'DELETE FROM `assos_l-t` WHERE ID_theme ='.$id.';';
	return query($sql);
}